package com.tradeplus.admin.dao;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.tradeplus.admin.model.Designation;

public class DesignationDaoImpl implements DesignationDao {
	
	private HibernateTemplate hibernateTemplate;

    public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
        this.hibernateTemplate = hibernateTemplate;
    }

	@Override
	public void saveDesignation(Designation designation) {
		hibernateTemplate.merge(designation);
	}

	@Override
	public List<Designation> loadDesignation() {
		return hibernateTemplate.find("from Designation");
	}

	@Override
	public Designation loadDesignationById(Long designationId) {
		return hibernateTemplate.get(Designation.class, designationId);
	}

	@Override
	public void deleteDesignation(Long designationId) {
		hibernateTemplate.delete(hibernateTemplate.get(Designation.class, designationId));
	}

}
